Configure the pool size via the extra option in TypeOrmModule.forRoot(). Use @nestjs/terminus with TypeOrmHealthIndicator for health checks. The health endpoint pings the database and returns a structured status object that load balancers and orchestrators can poll.
max pool size should not exceed the database server's max_connections setting divided by the number of app instances.
connectionTimeoutMillis: 2000 makes requests fail fast when the pool is exhausted rather than queuing indefinitely.
@nestjs/terminus provides health indicators for TypeORM, Prisma, Redis, HTTP, DNS, and custom checks.
Health endpoints are probed by Kubernetes liveness and readiness probes — keep them fast and lightweight.
Use TypeOrmHealthIndicator.pingCheck() for TypeORM; write a custom indicator for Prisma using prisma.$queryRaw.